System and method for generating a quantum circuit

ABSTRACT

Concepts, systems and methods are described for generating a quantum circuit from a Unitary Coupled Cluster (UCC) ansatz which represents the excitation of a reference state by a parameterised operator including excitation operators. The UCC ansatz includes multi-qubit Pauli operators, referred to as Pauli strings, determined from each excitation operator. The method comprises partitioning the Pauli strings into mutually commuting sets and sequencing the Pauli strings by set. Pauli gadgets are then generated from the Pauli strings by Trotterization, the Pauli gadgets having the same sequencing by set as the Pauli strings. Each set of Pauli gadgets is diagonalised to convert the Pauli gadgets into phase gadgets which are then transformed into one- and two-qubit native gates to generate the quantum circuit.

FIELD

The present application relates to quantum computing and in particularto a system and method for generating a quantum circuit.

BACKGROUND

The Variational Quantum Eigensolver (VQE) is a hybrid quantum-classicalalgorithm for the estimation of ground state energies of quantum systems(such as molecules) on Noisy Intermediate Scale Quantum (NISQ) devices[31, 37, 34]. It employs the variational principle to approximate theground state of some Hamiltonian (an eigenstate) using a subroutineperformed on a quantum computer inside a larger optimization routineperformed on a classical computer. In particular, the VQE systemutilises a parameterised quantum circuit as an ansatz (trial solution);the Unitary Coupled Cluster (UCC) ansatz [35] is thought to bewell-suited for this purpose.

The VQE algorithm typically involves preparing an initial quantum stateon a quantum computer and generating an ansatz quantum state by applyingthe parameterised quantum circuit to the initial quantum state. Theexpectation value of the resulting Hamiltonian (the energy of thequantum system being simulated) is determined based on the quantumproperties of the system. The parameters of the parameterised quantumcircuit are then updated in accordance with the VQE algorithm to try toreduce the expectation value in an optimization (minimisation) procedureto converge towards the ground (reference) state of the quantum system([101]).

The UCC ansatz is physically motivated by a molecular system and isbelieved to converge to chemical accuracy more quickly than alternativequantum circuits. However, the circuit depth of the UCC ansatz for manyexisting implementations scales poorly with respect to the size ofmolecule, and hence the time taken to run the subroutine can be long. Inaddition, the error rate of the subroutine scales with the number ofentangling gates required.

A quantum computer generally supports a fixed number (set) of qubits,for example, 8 or 16. Operations, implemented as gates, may be performedon the set of qubits. These gates are usually provided as one-qubitgates or two-qubit (entangling) gates according to the number of inputsto and outputs from the gate (quantum gates have the same number ofoutputs as inputs). The gates determine how the quantum computermanipulates the qubits of the quantum computer—hence these gatesgenerally represent low-level operations to be performed by the hardware(rather than being hardware devices themselves).

Each set of operations which is performed in parallel across the set ofqubits is referred to as a slice or layer—this can be considered asrepresenting one step or iteration of processing. An overall computationis usually made up of multiple such slices (typically different from oneanother). The number of slices required for the computation is referredto as the depth of the computation, and generally reflects the length oftime (duration) needed to perform the computation ([102]).

The UCC ansatz can be used to generate a specific configuration of one-and two-qubit native gates representing a quantum circuit forimplementation on a quantum computer. This generation process is oftenreferred to as compilation, with the UCC ansatz serving as the input tothe compilation and a quantum circuit comprising the specificconfiguration of gates as the output from the compilation. Differentcompilation strategies may result in different configurations of gatesfor performing the desired computations. This in turn may significantlyimpact the performance of the algorithm on a quantum computer, forexample, in terms of efficiency and error rate. Accordingly, enhancingthe compilation strategy may directly improve the performance of thecomputation being performed on the quantum computer hardware.

SUMMARY

Methods and systems for generating quantum circuits are defined in theappended claims and described below in detail.

In general overview, concepts, systems and methods are described forgenerating a quantum circuit. In one particular embodiment, systems andmethods are described for generating a quantum circuit from a UnitaryCoupled Cluster (UCC) ansatz. In embodiments the UCC ansatz representsthe excitation of a reference state by a parameterised operatorincluding excitation operators. The UCC ansatz includes multi-qubitPauli operators, referred to as Pauli strings, determined from eachexcitation operator. In embodiments, a method for generating a quantumcircuit includes partitioning the Pauli strings into mutually commutingsets and sequencing the Pauli strings by set. The method furthergenerating Pauli gadgets from the Pauli strings. In embodiments, thePauli gadgets have the same sequencing by set as the Pauli strings. Inembodiments, generating Pauli gadgets from the Pauli strings isaccomplished via by Trotterization. In embodiments, each set of Pauligadgets is diagonalised to convert the Pauli gadgets into phase gadgetswhich are then transformed into one- and two-qubit native gates togenerate the quantum circuit.

Also described is a system and a method for generating a quantumcircuit, in which a computer-implemented method comprises generating aquantum circuit from a Hamiltonian using a parameterised operatorincluding excitation operators to represent the excitation of areference state, wherein multi-qubit Pauli operators (referred to asPauli strings) are determined from each excitation operator. The methodcomprises: partitioning the Pauli strings into mutually commuting setsand sequencing the Pauli strings by set; generating Pauli gadgets fromthe Pauli strings by Trotterization, wherein the Pauli gadgets have thesame sequencing by set as the Pauli strings; diagonalising each set ofPauli gadgets to convert the Pauli gadgets into phase gadgets; andtransforming the phase gadgets into one- and two-qubit native gates togenerate the quantum circuit.

As disclosed herein, a system and method are provided for generating aquantum circuit from a Unitary Coupled Cluster (UCC) ansatz whichrepresents the excitation of a reference state by a parameterisedoperator including excitation operators. The UCC ansatz includesmulti-qubit Pauli operators, referred to as Pauli strings, determinedfrom each excitation operator. The method comprises partitioning thePauli strings into mutually commuting sets and sequencing the Paulistrings by set. Pauli gadgets are then generated from the Pauli stringsby Trotterization, the Pauli gadgets having the same sequencing by setas the Pauli strings. Each set of Pauli gadgets is diagonalised toconvert the Pauli gadgets into phase gadgets which are then transformedinto one- and two-qubit native gates to generate the quantum circuit.

The compilation strategy provided by such a system and method helps tosignificantly reduce the circuit depth and entangling gate count.Benchmarks on realistic molecules show that using such a strategy maysubstantially reduce the number of entangling gates and the circuitdepth—for example, in one investigation by an average of 75%, and by upto 89% (compared to a naïve compilation strategy employed by a standardcompiler such as IBM's Qiskit.

The present compilation strategy may be utilised in a situation whichstill involves a Trotterized Hamiltonian, but which does not necessarilyutilise the UCC ansatz. One example of such a further application is forQAOA (Quantum Approximate Optimization Algorithm). This application maybe used for general combinatorial optimisation problems: examplesinclude supply-line optimization and register allocation & jobscheduling.

In accordance with one aspect of the concepts, systems and techniquesdescribed herein, a computer-implemented method of generating a quantumcircuit from a Unitary Coupled Cluster (UCC) ansatz which represents theexcitation of a reference state by a parameterised operator includingexcitation operators, the UCC ansatz including multi-qubit Paulioperators, referred to as Pauli strings, determined from each excitationoperator, the method comprising: partitioning the Pauli strings intomutually commuting sets and sequencing the Pauli strings by set;generating Pauli gadgets from the Pauli strings by Trotterization,wherein the Pauli gadgets have the same sequencing by set as the Paulistrings; diagonalising each set of Pauli gadgets to convert the Pauligadgets into phase gadgets; and transforming the phase gadgets into one-and two-qubit native gates to generate the quantum circuit.

With this particular arrangement, a computer-implemented method ofgenerating a quantum circuit from a Unitary Coupled Cluster (UCC) ansatzis provided. The described method may include one or more of thefollowing features independently or in combination with one or moreother features. In embodiments, partitioning the Pauli strings intomutually commuting sets seeks to reduce (and ideally minimize) thenumber of sets. In embodiments, the partitioning may be performed usinga graph colouring algorithm. In embodiments, a phase gadget is a Pauligadget comprising only Z and I letters. In embodiments, each set ofPauli gadgets is diagonalised using a Clifford circuit. In embodiments,each set of Pauli gadgets is represented as: (i) a Clifford circuit;(ii) a set of phase gadgets, and (iii) an inverse Clifford circuit. Inembodiments, the Clifford circuits transform between the original basisof the Pauli gadgets and a new basis in which the Pauli gadgets arerepresented by a corresponding set of phase gadgets. In embodiments, inwhich for two qubits i and j, and S being a set of m mutually commutingPauli gadgets and am a Pauli letter on qubit k from Pauli gadget I,qubit i or j is diagonalised by conjugating with at most one entanglinggate and two single-qubit Clifford gates on each side of S betweenqubits i and j, providing:∃A,B∈{X,Y,Z}s·t.∀l∈{1, . . . ,m},σ _(il) {I,A}⇔σ _(jl) ∈{I,B}

In embodiments, the diagonalisation may be performed by finding thePauli string with the lowest weight; conjugating the corresponding Pauligadget with a single-qubit Clifford gate and entangling gates; andcommuting the Clifford gates through the rest of the Pauli gadgets untilall the Clifford gates are outside the adjacent Pauli gadgets. Inembodiments, transforming the phase gadgets into one- and two-qubitnative gates to generate the quantum circuit includes using the phasepolynomial formalism. In embodiments, transforming the phase gadgets byusing the phase polynomial formalism includes using the GraySynthprocedure. In embodiments, the method may further comprise performingClifford peephole optimisation by finding patterns of two-qubit Cliffordcircuits and replacing them with equivalent circuits with lower countsof entangling gates. In embodiments, performing Clifford peepholeoptimisation by finding patterns of two-qubit Clifford circuits andreplacing them with equivalent circuits with lower counts of entanglinggates comprises performing Clifford peephole optimisation by findingsmall patterns of two-qubit Clifford circuits and replacing them withequivalent circuits with lower counts of entangling gates. Inembodiments, the method reduces the count and depth of entangling gatesof the quantum circuit relative to a naïve synthesis of the quantumcircuit from the Pauli strings. In embodiments, the UCC corresponds to amolecular structure. In embodiments, the UCC corresponds to a quantumsystem which has a Hamiltonian which is subject to Trotterization. Inembodiments, the method is used to generate a quantum circuit based on aTrotterized Hamiltonian but without using the UCC. In embodiments, theTrotterized Hamiltonian corresponds to a Quantum ApproximateOptimization Algorithm.

In accordance with one aspect of the concepts, systems and techniquesdescribed herein, a compiler is configured to perform any and all of theabove recited methods.

In accordance with a further aspect of the concepts, systems andtechniques described herein, a system comprising at least one processorand a compiler configured to run on the processor to generate a quantumcircuit from a Unitary Coupled Cluster (UCC) ansatz which represents theexcitation of a reference state by a parameterised operator includingexcitation operators, the UCC ansatz including multi-qubit Paulioperators, referred to as Pauli strings, determined from each excitationoperator, the compiler being configured to: partition the Pauli stringsinto mutually commuting sets and sequencing the Pauli strings by set;generate Pauli gadgets from the Pauli strings by Trotterization, whereinthe Pauli gadgets have the same sequencing by set as the Pauli strings;diagonalise each set of Pauli gadgets to convert the Pauli gadgets intophase gadgets; and transform the phase gadgets into one- and two-qubitnative gates to generate the quantum circuit.

In accordance with a still further aspect of the concepts, systems andtechniques described herein, a method for running a Variational QuantumEigensolver (VQE) as a hybrid quantum-classical algorithm to approximatethe ground state of some Hamiltonian includes using a subroutineperformed on a quantum computer insider a larger optimization routineperformed on a classical computer, wherein the subroutine utilises aquantum circuit formed by diagonalising sets of Pauli gadgets to convertthe Pauli gadgets into phase gadgets and transforming the phase gadgetsinto one- and two-qubit gates. In embodiments, the method is performedto simulate a quantum system for determining the ground state of thequantum system.

In accordance with a still further aspect of the concepts, systems andtechniques described herein, a system for running a Variational QuantumEigensolver (VQE) as a hybrid quantum-classical algorithm to approximatethe ground state of some Hamiltonian using a subroutine performed on aquantum computer inside a larger optimization routine performed on aclassical computer, wherein the subroutine utilises a quantum circuitformed by diagonalising sets of Pauli gadgets to convert the Pauligadgets into phase gadgets and transforming the phase gadgets into one-and two-qubit gates.

In accordance with a still further aspect of the concepts, systems andtechniques described herein, a computer-implemented method of generatinga quantum circuit from a Hamiltonian using a parameterised operatorincluding excitation operators to represent the excitation of areference state, wherein multi-qubit Pauli operators, referred to asPauli strings, are determined from each excitation operator, the methodcomprising: partitioning the Pauli strings into mutually commuting setsand sequencing the Pauli strings by set; generating Pauli gadgets fromthe Pauli strings by Trotterization, wherein the Pauli gadgets have thesame sequencing by set as the Pauli strings; diagonalising each set ofPauli gadgets to convert the Pauli gadgets into phase gadgets; andtransforming the phase gadgets into one- and two-qubit native gates togenerate the quantum circuit. In embodiments, the Hamiltoniancorresponds to a Quantum Approximate Optimization Algorithm.

In accordance with a still further aspect of the concepts, systems andtechniques described herein, a system includes at least one processorand a compiler configured to run on the processor to generate a quantumcircuit from a Hamiltonian using a parameterised operator includingexcitation operators to represent the excitation of a reference state,wherein multi-qubit Pauli operators, referred to as Pauli strings, aredetermined from each excitation operator, the compiler being configuredto: partition the Pauli strings into mutually commuting sets andsequencing the Pauli strings by set; generate Pauli gadgets from thePauli strings by Trotterization, wherein the Pauli gadgets have the samesequencing by set as the Pauli strings; diagonalise each set of Pauligadgets to convert the Pauli gadgets into phase gadgets; and transformthe phase gadgets into one- and two-qubit native gates to generate thequantum circuit.

It should be appreciated that individual elements of differentembodiments described herein may be combined to form other embodimentsnot specifically set forth above. Various elements, which are describedin the context of a single embodiment, may also be provided separatelyor in any suitable sub-combination.

BRIEF DESCRIPTION OF THE FIGURES

Various examples and implementations of the disclosure will now bedescribed in detail by way of example only with reference to thefollowing figures:

FIG. 1 is a schematic diagram showing the use of graph colouring topartition Pauli terms into sets of mutually commuting Pauli strings inaccordance with examples of the approach described herein.

FIG. 2 illustrates a translation of relevant gates between the quantumcircuit and the zx-calculus formalisms in accordance with examples ofthe approach described herein.

FIG. 2A shows a representation of Φn(α) (a phase gadget) in ZX-calculusnotation as used in the present disclosure.

FIG. 2B illustrates the Pauli gadget diagrammatic notation for the Pauliexponential as utilised herein.

FIG. 3 shows an example of the procedure disclosed herein to diagonalisea qubit in accordance with Theorem 5.1.

FIG. 4 shows an example of pseudo-code for the diagonalisation methoddisclosed herein.

FIGS. 5 and 6 show an example of the diagonalisation method disclosedherein applied to an example set.

FIGS. 7A and 7B show examples of mappings between phase gadgets andquantum circuits using phase polynomials as an example of the approachdisclosed herein.

FIG. 8 shows an example of Clifford peephole optimisation as disclosedherein, in which small patterns of two-qubit Clifford circuits areidentified and replaced with equivalent circuits with lower ΛX counts.

FIGS. 9A, 9B and 9C show results from examples of ΛX metrics obtainedusing the compilation strategy disclosed herein in comparison with ΛXmetrics obtained using other known compilation strategies for use insimulating molecules with varying active spin orbitals and usingdifferent qubit encoding methods. FIG. 9 is split across three sheets,indicated as FIGS. 9A, 9B and 9C for the BK, JW and P qubit encoding,respectively.

FIG. 10 is a flowchart illustrating an example of performing acompilation in accordance with the compilation strategy disclosedherein.

FIG. 11 is a schematic diagram showing an example of a computingenvironment for utilising the compilation strategy disclosed herein.

DETAILED DESCRIPTION 1. General

The present disclosure provides (inter alia) a compilation strategy forVariational Quantum Eigensolver (VQE) algorithms which use the UnitaryCoupled Cluster (UCC) ansatz. This compilation strategy is designed toreduce circuit depth and gate count.

In general terms, the compilation strategy partitions terms from the UCCansatz into mutually commuting sets, based on an equivalence betweensuch a sequencing problem and graph colouring (this is described in moredetail below). These sets are then diagonalised using Clifford circuitsand synthesised using the phase polynomial formalism. It is shown thatapproximate solutions to this problem enable large-scale synthesis ofPauli exponentials into one- and two-qubit gates, and heuristics aredescribed for performing this synthesis to generate low depth circuits.(A one-qubit gate has a single qubit input and a single qubit output; atwo-qubit gate, which also represents an entangling gate, has two qubitinputs and two qubit outputs).

Such a compilation strategy helps to reduce a major source of erroraffecting the VQE algorithm: noise of the quantum device (computer). Thecompilation strategy increases circuit fidelity by reducing circuitdepth, thereby helping to reduce (and ideally minimise) the number ofnoisy gates and the exposure of qubits to decoherence.

The compilation strategy may be used for any ansatz which is generatedby Trotterization of an operator made up of a sum of Pauli tensorproducts. Accordingly, the compilation strategy may be applied to theUCC ansatz, including the k-UpCCGSD and other variations on the UCCSDansatz, such as UCCGSD [27] (it is not intended for the so-called“hardware efficient” ansatz [117]). Compilation of an ansatz using thisstrategy does not require a trade-off in accuracy or convergence rate.The strategy is generic, and does not require prior knowledge of thequbit encoding, target Hamiltonian or basis set.

Potential applications of the Unitary Coupled Cluster (UCC) method andansatz (and hence the compilation strategy described herein) include:

(a) Solid state physics—the Dynamical Mean Field Theory approach [111];examples include the Anderson impurity model [112] and the Hubbard model[113].

(b) Condensed matter simulations with periodic boundary conditions.

(c) Quantum optics—e.g. the Jaynes-Cummings model [114].

(d) Nuclear physics, for subatomic particles [115].

(e) Any quantum system which has a Hamiltonian which is subject toTrotterization. The Hamiltonian represents the energy of a quantumsystem; Trotterization is a method to convert the Hamiltonian intosmaller objects that are more amenable to implementation on a quantumcomputer.

The compilation strategy described herein has been implemented int|ket>, a retargetable compiler developed by Cambridge Quantum ComputingLtd [103], to obtain benchmarks for a variety of UCC circuits forrealistic molecules. These results demonstrate empirically that thecompilation strategy described herein helps to significantly reduce thetwo-qubit gate count and depth. For example, the compilation strategyhas been found to reduce ΛX depth by 77.5% on average, and by up to 89%,compared to naive synthesis, for a variety of molecules, qubit encodingsand basis sets.

The following terminology is adopted in this description:

a Pauli is a single-qubit operator (gate). There are four Paulis,corresponding to the 3 orthogonal axes (X, Y, Z) and I (the identityoperator). See [107], in which σ_(x) denotes the Pauli-X (and so on forother axes).

a Pauli string, or multi-qubit Pauli operator, is the tensor product oftwo or more of the single-qubit Paulis (I, X, Y, Z). Pauli stringscommute under addition but not necessarily under multiplication.

a Pauli exponential is an exponentiated Pauli string.

a Pauli gadget is used to denote a particular representation of a Pauliexponential (in effect therefore, a Pauli exponential is a Pauli gadgetand vice versa).

a phase gadget is a Pauli gadget in which all the Paulis in theexponentiated Pauli string are either I or Z. This exponentiated Paulistring (based on I and/or Z Paulis) is diagonal in form, and soconverting arbitrary exponentiated Pauli strings (Pauli gadgets) intophase gadgets is referred to as diagonalisation.ΛX gates are also known as CX or CNOT gates. They are a type of“entangling gate”, namely a gate which has 2-qubit inputs. These gatesare the most expensive part of the circuit, in the sense that theygenerally contribute the most noise (which can lead to quantumdecoherence). Accordingly, the number of these ΛX gates is an importantmetric in the quantum circuit, alongside the depth of the ΛX gates (thenumber of parallel layers of ΛX gates that must be performed to completethe circuit). Note that increasing depth implies that additional time isrequired to complete a quantum computation, and such additional timealso presents an increased risk that the quantum computation is subjectto noise and decoherence.

It should be noted that ΛX gates are just one type of entangling gate,and another type (or types) of entangling gate might be utilised insteadof (or as well as) ΛX gates. Accordingly, where the present descriptionrefers to ΛX gates, this is not intended to be by way of limitation, andit will be understood that corresponding reductions in gate count anddepth may also be achieved for implementations utilising other types ofentangling gate in conjunction with the approach described herein.

2. The Unitary Coupled Cluster Ansatz

The Unitary Coupled Cluster Ansatz is defined by the excitation of somereference state by an operator parameterised with coupled clusteramplitudes {right arrow over (t)}:|Ψ({right arrow over (t)})>=U({right arrow over (t)})|Φ₀ >=e^(T({right arrow over (t)})−T) ^(∛) ^(({right arrow over (t)}))|Φ₀>  (1)where the left-hand term defines the quantum properties of the systembeing modelled (which is specified as part of input to the VQEalgorithm) and the middle term represents the parameterised operatorapplied to an initial quantum state (also referred to as the UCCreference state). The operator T contains fermionic excitation operators{right arrow over (τ)} such that the parameterised operator can berewritten as:U({right arrow over (t)})=e ^(Σ) ^(j) ^(t) ^(j) ^((τ) ^(j) ^(−τ) ^(j)^(†) ⁾  (2)

This parameterised operator cannot be directly implemented on agate-based quantum computer. It must be mapped to qubits and decomposedinto native gates.

In order to generate a quantum circuit, we first employ Trotterization,as justified by Lloyd [29]. Here we show first order Trotterization inwhich the parameterised operator is approximated by a product ofexponential terms dependent on the fermionic excitation operators:

$\begin{matrix}{{{U\left( \overset{\_}{t} \right)} \approx {U_{Trott}\left( \overset{\_}{t} \right)}} = \left( {\prod\limits_{j}^{\;}e^{\frac{t_{j}}{\rho}{({\tau_{j} - \tau_{j}^{\dagger}})}}} \right)^{\rho}} & (3)\end{matrix}$where ρ is the Trotter step size. We assume ρ=1 for near-term cases.

To implement the Trotterized expression shown in Equation 3 on a quantumcomputer, we map the τ_(i) in the product to operations acting onqubits. This can be performed using a variety of qubit encodings, suchas Bravyi-Kitaev (BK), Jordan-Wigner (JW) and Parity (P) [36]. Theseencodings have different resource requirements and the qubits are givendifferent semantic meanings, but regardless of our choice we get:

$\begin{matrix}{\left( {\tau_{j} - \tau_{j}^{\dagger}} \right) = {{ia}_{j}{\sum\limits_{k}^{\;}P_{jk}}}} & (4)\end{matrix}$where a_(j)∈

and P_(jk)∈{I, X, Y, Z}^(⊗n).

We refer to an element of {I, X, Y, Z}^(⊗n) as a Pauli string, composedof letters from the alphabet {I, X, Y, Z}. The Pauli strings representmulti-qubit Pauli operators and are effectively supplied, as describedbelow, by the UCC ansatz (in accordance with the quantum system that isbeing simulated). The weight of a Pauli string is the number of non-Iletters that the Pauli string contains. It can be shown that the Paulistrings P_(jk) from a given excitation operator τ_(j) always commuteunder multiplication [35]. This then gives us an expression for theTrotterized operator:

$\begin{matrix}{{U_{Trott}\left( \overset{\_}{t} \right)} = {\prod\limits_{j}^{\;}{\prod\limits_{k}^{\;}e^{{it}_{j}a_{j}P_{jk}}}}} & (5)\end{matrix}$where the e^(it) ^(i) ^(a) ^(j) ^(P) ^(jk) terms are parameterised withsome angle t_(j) for our variational algorithm. We refer to theseparameterised terms as Pauli exponentials, and relabel our coefficientst_(j)′=t_(j)a_(j). Pauli exponentials can be implemented on a quantumcomputer by decomposition into one- and two-qubit native gates, asdiscussed below in Section 4 (Pauli Exponentials).

For noisy intermediate quantum scale (NISQ) devices, two-qubit gatestypically have error rates around an order of magnitude higher thanone-qubit gates, as well as taking typically 2-5× as long to operatethan one-qubit gates [38, 10]. Accordingly, minimising or at leastreducing the two-qubit gate count and depth is an important aim for acompilation strategy.

3. Term Sequencing

Looking again at Equation 2, note that we can expand the fermionicexcitation operators at this stage into Pauli strings using Equation 4,i.e. our chosen qubit encoding:U({right arrow over (t)})=e ^(iΣ) ^(j) ^(Σ) ^(k) ^(t) ^(j) ^(′P) ^(jk)  (6)

The P_(jk) terms all commute under addition. It is only after theTrotterization step that our Pauli exponentials do not commute. It istherefore sensible to sequence the Pauli strings at this stage in abeneficial order, such that our Trotterization incurs minimal Trottererror and our circuit has low resource requirements. It is generallythought that reducing Trotter error should be a secondary concern forVQE, compared with a focus on minimising ΛX gate count and depth.

Our approach to reducing the count and depth of the ΛX gates involvespartitioning the set of Pauli strings into a small number of subsets,such that within a given subset every Pauli string commutes undermultiplication. This problem is known in the literature on measurementreduction [22, 18, 40] and can be represented as a graph problem.

3.1 Graph Colouring

We represent each Pauli string as a vertex in an undirected graph. Anedge is given between any two vertices that correspond to Pauli stringswhich anti-commute. FIG. 1 shows an example of this graphrepresentation. Finding the minimum number of mutually commuting setswhich cover all vertices in this graph is then equivalent to thecolouring problem, a known NP-hard problem. Accordingly, FIG. 1 showsgraph colouring to partition the Pauli string into sets of mutuallycommuting strings. (N.B. While the parameters are not shown in FIG. 1,they are tracked for synthesis later).

We use a simple, ‘largest first’ greedy colouring algorithm to partitionthe Pauli strings [1]. The complexity of this algorithm is

(mn), with m the number of Pauli strings and n the number of qubits,although building the anti-commutation Pauli graph in the first placescales as

(m²n). The partitioning shown in FIG. 1 has generated two sets, onehaving vertices shown in blue (dark), the other having vertices shown inlight red (light).

Once the vertices have been assigned colours, the UCC reference state isprepared using a short quantum circuit, and the corresponding Paulistrings are appended, colour by colour (i.e. set by set), inlexicographical order. For example, given the graph colouring solutionfrom FIG. 1, a valid ordering of strings is: IIXY, IIYX, XYII, YXII,XXXY, XXYX, XYXX, XYYY, YXXX, YXYY, YYXY, YYYX.

In other words, this approach orders the Pauli strings by set (each setcomprising mutually commutating Pauli strings under multiplication),such that the Pauli strings from one set are together (contiguous), andthen the Pauli strings from another set, and so on. In effect, the Paulistrings are therefore partitioned by set. Note that the ordering of thesets themselves, i.e. which set is first in the sequence, which set issecond in the sequence, and so on, may be arbitrary, as long as thecontiguity of each set is maintained. Likewise, the ordering of thePauli strings within a given set is arbitrary (it does not have to belexicographical). This set-by-set ordering of the Pauli strings iscarried over into sequence of the Pauli exponentials which are derivedby Trotterization from the corresponding Pauli strings.

4. Pauli Exponentials

Notation: In order to reason about and represent the synthesis of thequantum circuit from the Pauli exponentials, we use notation inspired bythe ZX-calculus [14], although our strategy can be followed withoutrequiring knowledge of the inference rules of the calculus. Atranslation of relevant gates between the quantum circuit andZX-calculus formalisms is given in FIG. 2. In particular, FIG. 2comprises three columns, each column showing common circuit gates (left)and their representations in the scalar-free ZX-calculus (right). Theleft-most column shows blue/green (light) circles for operations withrespect to the Z axis, while the central column shows red (dark) circlesfor operations with respect to the X axis. The S gate corresponds to

${Rz}\left( \frac{\pi}{2} \right)$and the V gate to

${Rx}{\left( \frac{\pi}{2} \right).}$A brief introduction to the ZX-calculus is found in Fagan & Duncan [19];for a complete treatment see Coecke & Kissinger [15].

4.1 Phase Gadgets

We adopt the notation of phase gadgets in which Φn(α) is equivalent tothe operator

$e^{{- i}\frac{\alpha}{2}z^{\otimes n}}.$(This is consistent with the definition above that phase gadgets arePauli exponentials, or equivalently Pauli gadgets, in which all thePaulis are Z and/or I). These phase gadgets are described in Kissinger &van de Wetering [24], and have a natural representation in theZX-calculus. FIG. 2A shows representations of Φn(a) in ZX-calculusnotation. The algebra for phase gadgets and alternative decompositionsinto one- and two-qubit gates are given in [106]. (The colour scheme inFIG. 2A is the same as described above in relation to FIG. 2, with thephase gadgets being coloured light blue/green since they involveoperations with respect to the Z axis).

Note that the horizontal lines in FIG. 2A, and more generally indiagrams for the ZX-calculus, correspond to qubits (hence three qubitsare explicitly shown in FIG. 2A but more are implied by the verticaldotted lines). The left-hand diagram in FIG. 2A shows an n-input gatewherein n>2 (which cannot be physically implemented directly); theright-hand diagram in FIG. 2A shows an equivalent circuit formed onlyfrom two-qubit gates.

4.2 Pauli Gadgets

The correspondence between phase gadgets and Pauli-Z exponentialsgeneralises to any Pauli exponential,

$e^{{- i}\frac{\alpha}{2}\sigma_{1}\sigma_{2}{\ldots\sigma}_{n}},$oy conjugating the phase gadget with single-qubit Clifford gates([104]). In other words, we can generate any Pauli gadget (exponential)by conjugating a phase gadget with a single-qubit Clifford gate.

FIG. 2B illustrates the Pauli gadget diagrammatic notation for the Pauliexponential from Cowtan et al. [17], wherein Pauli exponentials arerepresented succinctly using the ZX-calculus notation of FIG. 2A. Thered, mixed-colour, and pale blue/green boxes shown in the right-handportion of FIG. 2B respectively represent the Pauli gadget acting on aqubit in the X, Y, and Z bases. These may be formed by a phase gadgetacting on the qubits (generating all Z interactions), and thenconjugating the qubits with appropriate single-qubit Clifford gates. TheClifford gates may be commuted through Pauli gadgets, but may incur aphase flip or basis change. Rules to perform this procedure for relevantClifford gates are provided in [106].

For a set of m Pauli gadgets over n qubits, we require

(nm) ΛX gates for naive synthesis. Precisely, we require at most 2m(n−1), if there are no I-Pauli gadgets. We propose herein a heuristicwhich synthesises a quantum circuit from a commuting set of Pauligadgets and show that this heuristic results in a reduced number of ΛXgates (compared with the naïve synthesis) for realistic examples foundin UCC ansatz circuits.

5. Set-based Synthesis

The approach disclosed herein has three steps:

1) Diagonalisation: every Pauli gadget in a given commuting set issimultaneously converted into a phase gadget by conjugating with anappropriate Clifford circuit.

2) Phase gadget synthesis: the resulting phase gadgets are convertedinto ΛX and Rz gates using the well-studied phase polynomial formalism[9].

3) Clifford peephole optimisation: two-qubit Clifford subcircuits areoptimised using graph rewriting techniques [19].

Terminology: An adjacent sequence of Pauli gadgets is diagonal whenevery Pauli string is only over Z and I letters, i.e. every Pauli gadgetis a phase gadget. A qubit is diagonal over a set when, for every Paulistring in that set, the Pauli letter on that qubit is either a Z or I. AClifford circuit is a circuit formed from Clifford gates.

5.1 Diagonalisation

Recall that [A, B]=0⇔[U AU^(†),U BP^(†)]=0 for unitaries A, B and U.This allows us to conjugate Pauli gadgets with Clifford gates whilemaintaining commutation between all gadgets. Given an initial commutingset of Pauli gadgets S, we are searching for a Clifford circuit C andphase gadget circuit S′ such that:S=CS′C ^(†)  (7)

Equation 9 can be regarded as a change in basis from the initial basisof the Pauli gadgets to a new basis in which the set of Pauli gadgets isdiagonalised—i.e. it can be represented by a set of phase gadgets S′.The motivation here is that although the Clifford gates representadditional gates (compared with the original Pauli gadgets S), this ismore than compensated for by the compact gate implementation of thediagonalised phase gadgets S′(compared with a direct gate implementationfor the original Pauli gadgets S). In other words, the reductionachieved by transitioning from Pauli gadgets to phase gadgets outweighsthe additional Clifford gates used to accomplish this transition.

In general, we want to perform the diagonalisation on the largestpossible sets of Pauli exponentials (Pauli gadgets S), as the bigger theset the more efficient the compilation when done using phase polynomialsynthesis (as described below). Accordingly, this increased efficiencyprovides the motivation to gather the Pauli strings (which will becomethe Pauli exponentials) into sets, and to sequence the Pauli strings byset, as described above.

Jena et al. previously gave an algorithm guaranteed to give such aClifford circuit C [22], although this algorithm is inefficient in termsof ΛX gates. Form Pauli gadgets, Crawford et al. recently presented twoefficient constructions of C with a bound of mn−m(m+1)/2 and

(mn/log m) ΛX gates respectively, when m<n [18]. When n, theconstruction provided by Aaronson and Gottesman requires

(n²/log n) ΛX gates [2, 30].

We find that the ΛX count of a Clifford circuit used for diagonalisationis typically much less than the asymptotic worst case for realisticexamples in UCC ansatz circuits. We present below a heuristic based ondiagonalising a qubit from a two-qubit chain.

5.1.1 Diagonalising a Two-Qubit Chain

Theorem 5.1. Given two qubits i and j, let S be a set of m mutuallycommuting Pauli gadgets, and σ_(kl) a Pauli letter on qubit k fromgadget I. Conjugating with at most one ΛX and two single-qubit Cliffordgates on each side of S between qubits i and j is sufficient todiagonalise either qubit i or j iff:∃A,B∈{X,Y,Z}s.t.∀l∈{1, . . . ,m},σ _(il) {I,A}⇔σ _(jl) ∈{I,B}  (8)

Proof. Consider the action of conjugating each of the 16 possibletwo-qubit Pauli strings over qubits i and j with ΛX gates, with thecontrol on qubit i and the target on qubit j. The set of strings forwhich this action diagonalises qubit j is D:={II, IZ, XX, XY, YX, YY,ZI, ZZ}. By inspection, σ_(il)∈{Z, I}⇔σ_(jl)∈{Z, I}, ∀I∈{1, . . . , 8}.The application of single-qubit Clifford gates may permute the Paulis oneach qubit independently, but the corresponding relation must still besatisfied for whichever Pauli permutation the single-qubit Cliffordgates have generated, i.e. ∃A, B∈{X,Y,Z} s.t.∀l∈{1, . . . ,m},σ_(il){I,A}⇔σ_(jl)∈{I,B}.

Theorem 5.1 determines the single-qubit Clifford gates required toconvert to the basis in which conjugation by ΛX gates will diagonalise aqubit. We demonstrate this in FIG. 3, which shows the application ofTheorem 5.1 to diagonalise a qubit. FIG. 3a shows the initial circuit,including a two-qubit chain, for which Theorem 5.1 is satisfied by A=Yand B=Y. Therefore, we require V and V^(†) gates to convert to thecorrect basis such that A=Z and B=Z, as shown in FIG. 3b . We can thenchoose which qubit to diagonalise. Arbitrarily, we pick the second bit,and conjugate with the required ΛX gates as shown in FIG. 3c (in whichthe second qubit is shown comprising a sequence of phase gadgets).Applying Theorem 5.1 to appropriate two-qubit chains is a subroutine inour procedure to diagonalise arbitrary adjacent commuting Pauli gadgets(see FIG. 4 below).

5.1.2 Diagonalisation Algorithm

Pseudo-code for the diagonalisation method disclosed herein is presentedin FIG. 4. This method comprises three functions, of which the thirdfunction represents the main routine. This main routine first calls theupdate single qubits subroutine (the first function in FIG. 4), whichcorresponds to step (i) in the algorithm below. The main routine thencalls the update pairs of qubits subroutine (the second function in FIG.4), which corresponds to step (ii) in the algorithm below. The mainroutine then calls the greedy diagonalisation subroutine, whichcorresponds to step (iii) in the algorithm below (the implementation ofthis subroutine is readily apparent to the skilled person and is omittedfrom FIG. 4).

The overall time complexity for this algorithm is

(mn³), with m the number of Pauli gadgets in the commuting set and n thenumber of qubits. FIGS. 5 and 6 (the latter being a continuation of theformer) illustrate this method applied to an example set, as shown inFIG. 5a , having 5 qubits. The strings in this mutually commuting setare: IXZIZ, IYIZY, XXIYI, YYXII, ZIYXX, ZXIZZ, and ZYZIY. The methodcomprises the following operations: (i) Check whether there is atrivially diagonalisable qubit: that is, a qubit i for which ∃P∈{X, Y,Z} s.t. ∀I, σ_(il)∈{I,P}. Any such qubits may be diagonalised with onlysingle-qubit Clifford gates, and ignored for the subsequent steps. Thischeck takes time

(mn). The example set of FIG. 5a contains no such qubits.

(ii) Now search fora pair of qubits that satisfy Theorem 5.1 for anychoice of Paulis A and B. This search can be performed in

(mn²). If such a pair of qubits is found, perform the diagonalisation asspecified in Theorem 5.1 above. There is no valid choice of A and B forany pair of qubits in the example set of FIG. 5 a.(iii) If the search is unsuccessful, adopt a greedy approach as a backupstrategy. In

(m), find the Pauli string with the lowest weight; if there are multiplesuch Pauli strings, pick one arbitrarily. Conjugate the correspondingPauli gadget with a single-qubit Clifford gate and ΛX gates to convertthe Pauli string to II . . . IZ, as illustrated in FIG. 5b . Then,commute the Clifford gates through the rest of the gadgets, as shown inFIG. 5c , until all Clifford gates are outside the adjacent Pauligadgets. Every gadget must still commute with the IIIIZ string, andtherefore the last qubit must be diagonal.

Steps (i) through (iii) are repeated (iterated) until all qubits arediagonal over the set of Pauli gadgets. Following our example in FIG. 5,we find that FIG. 5c has the same two-qubit chain on the first andsecond qubits as our example from FIG. 3a , and can therefore bediagonalised in the same way. This diagonalisation results in thecircuit in FIG. 6a . The backup strategy of step (iii) is not requiredfor the remaining qubits, rather these can be diagonalised using steps(i) and (ii) above to produce the circuit shown in FIG. 6b after fulldiagonalisation. However, in the case that trivially diagonalisablequbits cannot be found, n repetitions of the steps (i) through (iii) areperformed, so the method shown by the pseudo-code of FIG. 4 has timecomplexity

(mn³). If the greedy approach of step (iii) has to be repeatedlyperformed (because trivially diagonalisable qubits cannot be found), C(the Clifford circuit) will require

(n²) ΛX gates. If we can find an application of Theorem 5.1 for eachiteration, in other words, if we do not use step (iii) above for anyiteration, then C will require at most n−1 ΛX gates. For the smallexample set in FIG. 5A, where m=7 and with n=5 (and where step (iii) wasused in the first iteration), C was found to use 5 ΛX gates.

5.2 Phase Polynomials

After diagonalisation, the interior section for each set is comprisedentirely of phase gadgets (corresponding to S′ in FIG. 7). This phasegadget circuit can be expressed as a phase polynomial [9]. Phasepolynomials have been used for circuit optimisation [32, 30, 9, 4], andthe representation of phase gadget circuits as phase polynomials hasalso led to circuit optimisation techniques [11].

Let D be a quantum circuit containing only ΛX gates and the gatesRz(θ₁), Rz(θ₂), . . . , Rz(θ_(m)). The action of Don a basis state|x₁,x₂ . . . x_(n)) has the form:D|x ₁ ,x ₂ , . . . x _(n) >=e ^(ip(x) ¹ ^(,x) ² ^(, . . . ,x) ^(n) ⁾|h(x ₁ ,x ₂ . . . x _(n))>  (9)where state h(x₁,x₂ . . . x) is a linear reversible function and

$\begin{matrix}{{p\left( {x_{1},x_{2},\ldots\mspace{14mu},x_{n}} \right)} = {\sum\limits_{i = 1}^{m}{\theta_{i}{f_{i}\left( {x_{1},x_{2},\ldots\mspace{14mu},x_{n}} \right)}}}} & (10)\end{matrix}$is a linear combination of affine Boolean functions f_(i):{0,1}^(n)→{0,1}. The phase polynomial of circuit D is state p(x₁,x₂ . .. x_(n)). For a further description, see Nam et al. [32].

FIGS. 7A and 7B show examples of mappings between phase gadgets andquantum circuits using phase polynomials. The quantum circuit in FIG. 7Ais equivalent to a phase gadget over two qubits. This generalises inthat any phase gadget over n qubits is equivalent to a phase polynomialwith one term, as illustrated in FIG. 7B. For all phase gadget circuits,the linear reversible function h is identity.

The phase polynomials described herein are therefore synthesised into aquantum circuit having ΛX gates and Rz(θ) gates with a low ΛX gatesoverhead using a heuristic from Amy et al. [7]. Optimal synthesis ofphase polynomials into ΛX gates has been found to be NP-complete inspecific cases, but the time complexity of finding the optimal ΛX gatecount in the general case is unproven.

We use the so-called ‘GraySynth’ heuristic from [7] to find subsets ofp(x₁,x₂ . . . x_(n)) that can be efficiently iterated with a fixedtarget qubit. The GraySynth procedure runs in time

(mn³), and requires a maximum of

(mn) ΛX gates when the linear

reversible function h is identity [6] (as is the case for the approachdescribed herein). The implementation in Amy et al. reduced the ΛX gatecount by 23% across a suite of Clifford+T benchmark circuits, with amaximum reduction of 43%.

The circuit transformations described above in Sections 3.1 and 5.1enable us to partition our circuit into large phase polynomials dividedby regions of Clifford circuits, thereby allowing the GraySynthalgorithm to synthesise these phase polynomials with low ΛX overhead.The synthesised circuit generated from the interior phase gadgets forour example set of FIG. 5a is shown in FIG. 6c . Through naivedecomposition, this initial set from FIG. 5a would require 34 ΛX gates,and 34 ΛX depth. The compilation approach described herein allows the ΛXcount to be reduced to 22 and the ΛX depth to 18.

5.3 Clifford Peephole Optimisation

At this stage (after the use of the phase polynomial formalism), theansatz circuit is in a form with layers of Clifford operations between{ΛX,Rz} circuits. Referring back to Equation 7, the Clifford gates C(and C^(†)) may be directly implemented, while the phase polynomialformalism has provided a synthesis for S′. Although such an ansatzcircuit could be used at this stage, an additional procedure may beperformed (if desired) to further reduce the ΛX count.

Apart from basic cancellation of adjoint gates between Clifford layers,it is also possible to perform peephole optimisation by finding smallpatterns of two-qubit Clifford circuits and replacing them withequivalent circuits with lower ΛX counts. This processing is shown inFIG. 8, in which certain Clifford identities are recognised and appliedto reduce the ΛX count [19]. (In FIG. 8, the S gate corresponds to

$R{z\left( \frac{\pi}{2} \right)}$and the V gate corresponds to

$\left. {R{x\left( \frac{\pi}{2} \right)}} \right).$A single sweep of this optimisation can be performed in

(dn²), where d is the circuit depth. Note that performing the rewriterules may generate more instances where they can be applied, i.e. thereplacement equivalent circuits with lower ΛX counts may themselves leadto further patterns which can be replaced by equivalent circuits withlower ΛX counts. Accordingly, an iterative approach may be used, inwhich the rewrite rules are re-applied until no more suitable patternscan be found, and/or until a chosen number of sweeps (iterations) havebeen applied, for example, to suit a specified compilation time.

The pattern-matching and rewriting of the Clifford peephole optimisationis performed using a directed acyclic graph (DAG), with verticesrepresenting gates and edges representing qubits. Ports track the orderof incident edges to a vertex in order to represent non-commutativeoperations such as the ΛX gate. This graph rewriting to perform peepholeoptimisation for quantum circuits is described in general terms in [5,32, 17], and has been performed for Clifford circuits in particular byKliuchnikov and Maslov [25]. This final step of the compilation processmay be considered a relatively minor (and optional) ‘clean-up’ step.

Table 1 summarises the relevant complexities of the differentsubroutines in the overall compilation strategy described herein, inwhich m is the total number of Pauli exponentials, d is the depth of thecircuit, and n is the number of qubits. Time complexity refers to thecompilation time taken for this strategy, while ΛX complexity is definedas the maximum number of ΛX gates required for the circuit synthesis.Note that graph colouring and Clifford rewriting do not perform circuitsynthesis and therefore do not have an associated ΛX complexity.

TABLE 1 Time complexity ΛX complexity Graph colouring

  (m²n) — Diagonalisation

  (mn³)

  (n²) GraySynth [7, 6]

  (mn³)

  (mn) Clifford Rewriting

  (dn²) —

6. Results

The compilation strategy described herein has been implemented in theretargetable compiler t|ket> to benchmark this implementation on a suiteof ansatz circuits for solving VQE problems relating to the electronicstructure of molecules. This benchmarking included the molecules H₂, H₄,H₈, LiH, NH, H₂O, CH₂, NH₃, HNO, H₂CO and CO₂ in the ‘sto-3g’ basis sets([105]). For the smaller molecules, we also used the ‘63 1g’ and‘ccpvdz’ bases ([105]). We tested across the Bravyi-Kitaev (BK),Jordan-Wigner (JW) and Parity (P) encodings referenced above.

The benchmarking comparisons made are between:

1. Naive decomposition: a quantum circuit generated by iterating throughthe list of Pauli exponentials given by naive Trotterization of theexcitation operators and converting each Pauli exponential individuallyinto ΛX ladders (patterns of ΛX gates extending in the depth directionof the circuit).2. Templated lexicographical operator sequence (TLOS): for ansatzcircuits generated using the JW encoding, we compare against a simpleimplementation of the best known previous strategy for JW circuitsynthesis: operator sequencing methods from Hastings et al. [21] withtemplated excitation operators from Nam et al. [3]. We assume the qubitresources are scarce and do not allow the use of ancillae for thiscomparison (Hastings et al. showed that the use of ancillae may reduceΛX overhead significantly). We are not aware of similar strategies forthe BK or P encoding.3. Pairwise synthesis: a quantum circuit generated by graph colouringand then synthesising Pauli gadgets within a set in a pairwise mannerusing the methods from Cowtan et al. [17].4. Set synthesis: our full compilation strategy—graph colouring,diagonalisation, phase polynomial synthesis and Clifford peepholerewriting.

Circuits in our test set were chosen to have a ΛX count and depth ofless than 10⁶ when decomposed naively. All results were obtained using amachine with a 2.3 GHz Intel Core i5 processor and 8 GB of 2133 MHzLPDDR3 memory running MacOS Mojave v10.14.

A comparison of ΛX metrics for different compilation strategies formolecules with varying active spin orbitals and using different qubitencoding methods is shown in FIG. 9. Note that FIG. 9 is split acrossthree sheets as FIGS. 9A, 9B and 9C representing the BK, JW and P qubitencoding respectively. The naïve decomposition (1) is labelled as “nocolouring” in FIG. 9 and a 4th-degree polynomial least-squares fit hasbeen added to the plots to suggest scaling. It can be seen that theset-based synthesis strategy (4) as disclosed herein outperformspairwise (3) and naive (1) on all encodings, and performs approximatelyequally with the TLOS method (2) for the JW encoding.

TABLE 2 Qubit Encoding Mean ΛX count Mean ΛX depth Method reduction (%)reduction (%) Pairwise Synthesis BK 48.2 60.0 Set-based Synthesis BK65.5 73.2 Pairwise Synthesis JW 66.4 72.2 Set-based Synthesis JW 81.384.6 TLOS Synthesis JW 81.6 84.0 Pairwise Synthesis P 46.2 59.8Set-based Synthesis P 68.2 75.3 Pairwise Synthesis All 53.6 64.0Set-based Synthesis All 71.8 77.5

Set-based synthesis gives greater fractional reductions for largercircuits than for smaller ones. For the largest circuits, a reduction ofup to 89% in ΛX depth has been achieved, compared to the mean averagereduction in ΛX depth of 77.5% as presented in Table 2.

Note that the compilation strategy described herein generally assumesthe qubits have all-to-all connectivity, in other words, ΛX gates areallowed between any two qubits. Some hardware implementations of aquantum computer may constrain such connectivity; in this caseappropriate routing may be utilised to help a circuit conform to theconstraints (see below).

7. Discussion

Accordingly, the approach described herein represents an empiricallysuccessful method to efficiently synthesise the UCC ansatz into one- andtwo-qubit gates. This approach has been shown to achieve large averagereductions in ΛX metrics for the Bravyi-Kitaev and Parity qubitencodings, and to match an existing strategy for the Jordan-Wignerencoding. It is emphasised that the approach described herein is notlimited to these three qubit encodings, but rather may be utilised forany other qubit encodings which generate similar Trotterized excitationoperators. Furthermore, although the present approach has been describedin the context of the synthesis of a UCC ansatz, this approach may beutilised in other situations and contexts, as discussed below.

7.1 Applications for Measurement Reduction

Measurement reduction for VQE is a method to simultaneously measureterms in a Hamiltonian which commute and thereby reduce the number ofcircuits required to run VQE [22, 18, 40]. For realistic devices,assuming that the only available native measurements are single-qubitZ-basis measurements, generating a Clifford circuit to diagonalise thisset is required. Minimising this Clifford circuit using Theorem 5.1 aspresented above may reduce the ΛX overhead required for this measurementreduction.

7.2 Architecture-Aware Synthesis

Instead of introducing a SWAP network to enforce connectivityconstraints on NISQ devices, recent work has explored the possibility ofresynthesising a circuit in a topologically aware manner for limitedgate sets [23, 33, 39]. This constrained synthesis has been found totypically produce lower ΛX counts than SWAP networks, and phasepolynomials are a viable class of circuit for constrained synthesis [8].If topologically constrained phase polynomials can be composed withClifford regions in a manner that respects architecture, this wouldappear to be a promising strategy for those devices with limitedconnectivity.

7.3 Applications to Fault Tolerant Computation

Although the approach described herein has been implemented for VQE, itmay be directly ported over to nonvariational quantum algorithms forHamiltonian dynamics which require gate counts and qubit numbers thatare too high for NISQ computers. Recent work by Gui et al. [20] hasperformed term sequencing for quantum evolution defined by atime-dependent Hamiltonian which is mapped to a quantum circuit.Reducing Trotter error is more important for fault-tolerant algorithmsthan for VQE, and Gui et al. argue term sequencing (such as performed inthe present application) would help to reduce, and ideally minimise,Trotter error.

The compilation strategy proposed herein is primarily intended to reducetwo-qubit gate count and depth; however, these parameters are notconsidered to be as expensive on planned fault tolerant devices as magicstates, since the ΛX gate can be performed without distillation.However, work by Litinski [28] shows that on surface code-basedcomputers, performing a two-qubit gate may be as costly in the worstcase as magic state distillation, hence two-qubit gate reduction wouldstill represent a valuable optimisation.

Moreover, the circuits produced by the compilation strategy disclosedherein have a structure such that all non-Clifford gates reside inpartitioned phase polynomials. T-count and depth optimisation have beensuccessfully performed using the phase polynomial formalism via matroidpartitioning [9], with benchmarks showing up to 65.7% T-count reductionand 87.6% T-depth reduction without ancillae, and up to 99.7% T-depthreduction using (with) ancillae. The parities of non-Clifford rotationsin a phase polynomial generated via diagonalisation must all bedifferent, and therefore the T-counts cannot be optimised usingphase-folding; nevertheless, T-depth reduction may still be achievedusing the compilation strategy described herein.

8. General

FIG. 10 is a flowchart showing an example method in accordance with theapproach described herein. This method is generally implemented by acompiler used to generate a quantum circuit for use in a quantumcomputer. The method commences with receiving as input the UCC ansatz atoperation 110. The UCC ansatz (which is a known entity) includes, interalia, Pauli strings corresponding to (derived from) excitation operatorsfor a Hamiltonian that describes a physical (quantum) system. Forexample, the UCC ansatz is commonly used to simulate molecular systems,such as to determine the ground state and configuration for such amolecular system, and the excitation operators reflect the physicalproperties of the molecular system which is being simulated.

At operation 120, the Pauli strings from the UCC ansatz are partitionedinto sets, such that all the Pauli strings in a given set are requiredto commute with one another under multiplication. Conversely, Paulistrings that are partitioned into different sets are not required tocommute with each other under multiplication. Each Pauli string from theUCC ansatz is allocated (partitioned) into a single set. The objectiveis to have as few sets as possible, which also implies that the sets aregenerally large to accommodate all the Pauli strings from the UCCansatz. A graph colouring algorithm may be used to find a partitioningsolution which satisfies (exactly or approximately) this objective.

At operation 130, the Pauli strings are sequenced by set, i.e. all thePauli strings in a given set are contiguous with one another in thesequencing. An arbitrary ordering may be used for the Pauli stringswithin any given set, and also between the different sets.

At operation 140, Trotterization is used to generate a sequence of Pauligadgets, such that Pauli gadgets that derive from Pauli strings in agiven set are likewise grouped contiguously. The Trotterization providesan approximation of the Hamiltonian based on the Pauli gadgets tofacilitate further analysis.

The sequence of Pauli gadgets from operation 140 may be used directly toprovide a potential quantum circuit implementation of the UCC ansatz,however, such a quantum circuit may be relatively complex. Therefore atoperation 150, a Clifford circuit is determined to diagonalise each setof Pauli gadgets into a corresponding set of phase gadgets. Phasegadgets are a subset of Pauli gadgets having a diagonalised form, whichin turn helps to achieve a more compact and efficient quantum circuitimplementation of the UCC ansatz.

Accordingly, in operation 150, a set of Pauli gadgets from operation 140is equated to an expression comprising three components: (i) a Cliffordcircuit; (ii) a set of phase gadgets, and (iii) an inverse (conjugated)Clifford circuit. The Clifford circuits in effect transform between theoriginal basis of the Pauli gadgets and a new basis in which the Pauligadgets are phase gadgets. Although the Clifford circuits used to thesebasis changes represent additional overhead, i.e. additional gates, inthe resulting quantum circuit, this cost is outweighed by the savings(in gates) arising from the use of phase gadgets rather than the moregeneral Pauli gadgets.

Note that the diagonalisation is performed separately on each set ofPauli gadgets. The larger the set (i.e. the more Pauli gadgets itcontains), the greater the saving that is typically achieved as a resultof converting the Pauli gadgets to phase gadgets—hence the motivation tofind large sets in the partitioning of operation 120. Note also thatalthough the present implementation uses Clifford circuits for thediagonalisation from Pauli gadgets to phase gadgets, other techniquesfor performing such a diagonalisation might also be implemented.

Once the sequence of Clifford circuits and phase gadgets has beendetermined at operation 150, then the sequence of diagonalised phasegadgets is converted into native gates at operation 160 using the phasepolynomial formalism (or any other suitable technique for synthesizingnative gates from phase gadgets). In addition, the Clifford circuits maybe simplified in operation 170 using a technique such as peepholeoptimisation. Note that this optimisation of operation 170 is optionaland may be omitted in some implementations. Furthermore, the ordering ofoperations 160 and 170 may be altered if so desired, e.g. so thatoperation 170 is performed before or at the same time as operation 160.

The outcome of the processing of FIG. 10 is that a quantum circuit issynthesized to represent the received UCC ansatz, and this quantumcircuit can then be implemented on a quantum computer to simulate thephysical (e.g. molecular) system represented by the UCC ansatz.

FIG. 11 is a schematic diagram of a computing system for implementingthe approach described herein. The computing system includes a quantumcomputer 250 and a classical (non-quantum computer) 210. Note that forclarity, the standard internal hardware and software components ofclassical computer 210, such as a processor, memory, storage,input/output, communications, operating system and so on that are notdirectly relevant to an understanding of the approach described hereinare omitted from FIG. 11. Likewise, the standard internal components ofquantum computer are generally omitted from FIG. 11, with the exceptionof qubits 255.

The UCC ansatz 215 is created or loaded onto computer 210 where itserves as an input to a compiler 220. The compiler 220 may implement themethod of FIG. 10 to derive a quantum circuit 260 from the UCC ansatz.As described above, the quantum circuit 260 derived from this method iswell-suited to the hardware characteristics of the quantum computer 250by reducing ΛX counts (for the number and depth of such gates), therebyhelping (inter alia) to reduce noise and the susceptibility todecoherence.

In general, the compiler generates the quantum circuit 260 on theclassical computer 210 and the quantum circuit is then loaded onto thequantum computer 250 at run-time as part of the VQE system 225. Notethat although FIG. 11 shows the VQE system 225 running on the sameclassical computer 210 as compiler 220, in many implementations thecompiler 220 will run on one classical computer at compile time and theVQE system will run on a different classical computer at run time. TheVQE performs an iterative optimisation in which certain functionalitywithin the iterative procedure is off-loaded from the classical computer220 onto the quantum computer 250. In particular, each iteration of theoptimisation procedure calls the procedure implemented on the quantumcomputer to perform a computation, and the iterations are repeated untilan optimisation, e.g. minimisation has been achieved. By way of example,each iteration may determine an energy for a quantum system given a setof one or more parameter values, and the optimisation seeks to identifythe set of parameter values that produce the lowest energy for thesystem, this then corresponding to the ground state.

As described herein, a system and method are disclosed for providing aquantum circuit. The method is typically implemented by running compiler220, whereby the compiler is a computer program comprising programinstructions that when executed on a computing device causes thecomputing device to perform such a method. The compiler may be providedon a suitable storage medium such as described below for loading intothe memory for execution by a processor. The system is typicallyimplemented by a combination of the compiler 220 and the computer 210and hence may represent a combination of hardware and software. Thehardware (machine) may comprise a standard, general-purpose computingdevice, or in some implementations, the hardware (computing device orsystem) may include more specialised components. The software generallycomprises the compiler 220 and an environment (operating system etc.)for running the compiler. The program instructions of the compiler 220are typically loaded into memory of the computer 210 for execution byone or more processors to cause the computer to perform the method ofFIG. 10. The computer program may be stored in a non-transitory mediumprior to loading into memory, for example, on flash memory, a hard diskdrive, etc.

The approach described herein may include three main steps.

(1) perform macroscopic term sequencing for the circuit using Paulistrings. This sequencing is equivalent to a known problem in graphtheory called the colouring problem. A popular greedy algorithm may beused to approximate the solution to this problem ([116], [20]). Thisterm sequencing supports the following two steps.(2) convert the Pauli strings into phase gadgets. This conversion iscalled diagonalisation [22].(3) convert the phase gadgets into gates which can be run natively on aquantum computer using the phase polynomial formalism [9]. Thisconversion can be performed efficiently using a heuristic known asGraySynth [8].

Unlike many previous compilation strategies for chemistry circuits, thepresent approach is agnostic to many problem specifics, such as qubitencoding, basis set and molecule of choice. The present approach thereprovides a generic compilation strategy for the UCC ansatz.

Indeed, the present compilation strategy may be utilised beyond the UCCansatz. One example of such a further application is for QAOA (QuantumApproximate Optimization Algorithm), see [109]. This application is alsobased on a Trotterized Hamiltonian (as for the UCC ansatz), and is usedfor general combinatorial optimisation problems: examples includesupply-line optimization (related to the travelling salesman problem),and register allocation & job scheduling ([110]).

Various implementations and examples have been disclosed herein. It willbe appreciated that these implementations and examples are not intendedto be exhaustive, and the skilled person will be aware of many potentialvariations and modifications of these implementations and examples thatfall within the scope of the present disclosure. It will also beunderstood that features of particular implementations and examples cantypically be incorporated into other implementations and examples(unless the context clearly indicates to the contrary). In summary, thevarious implementations and examples herein are disclosed by way ofillustration rather than limitation, and the scope of the presentinvention is defined in the appended claims.

REFERENCES

-   [1] Networkx Greedy Color. Available at    https://networkx.github.io/documentation/stable/reference/algorithms/generated/networkx.algorithms.coloring.greedy_color.html.-   [2] S. Aaronson & D Gottesman (2004): Improved Simulation of    Stabilizer Circuits. Phys. Rev. A 70(052328),    doi:10.1103/PhysRevA.70.052328.-   [3] Yunseong Nam et al. (2019): Ground-state energy estimation of    the water molecule on a trapped ionquantum computer. arXiv.org.-   [4] M. Amy, D. Maslov, M. Mosca & M. Roetteler (2013): A    Meet-in-the-Middle Algorithm for Fast Synthesis of Depth-Optimal    Quantum Circuits. IEEE Transactions on Computer-Aided Design of    Integrated Circuits and Systems 32(6), pp. 818-830,    doi:10.1109/tcad.2013.2244643. Available at    http://dx.doi.org/10.1109/tcad.2013.2244643.-   [5] M. Amy, D. Maslov, M. Mosca & M. Roetteler (2013): A    Meet-in-the-Middle Algorithm for Fast Synthesis of Depth-Optimal    Quantum Circuits. IEEE Transactions on Computer-Aided Design of    Integrated Circuits and Systems 32(6), pp. 818-830,    doi:10.1109/TCAD.2013.2244643.-   [6] Matthew Amy (2020): Personal correspondence.-   [7] Matthew Amy, Parsiad Azimzadeh & Michele Mosca (2018): On the    controlled-NOT complexity of controlled-NOT-phase circuits. Quantum    Science and Technology 4(1), p. 015002,    doi:10.1088/2058-9565/aad8ca.-   [8] Matthew Amy & Vlad Gheorghiu (2019): staq—A full-stack quantum    processing toolkit. arXiv.org.-   [9] Matthew Amy, Dmitri Maslov & Michele Mosca (2014):    Polynomial-Time T-Depth Optimization of Clifford+T Circuits Via    Matroid Partitioning. IEEE Transactions on Computer-Aided Design of    Integrated Circuits and Systems 33(10), pp. 1476-1489,    doi:10.1109/TCAD.2014.2341953.-   [10] Frank Arute, Kunal Arya, Ryan Babbush, Dave Bacon, Joseph C.    Bardin, Rami Barends, Rupak Biswas, Sergio Boixo, Fernando G. S. L.    Brandao, David A. Buell, Brian Burkett, Yu Chen, Zijun Chen, Ben    Chiaro, Roberto Collins, William Courtney, Andrew Dunsworth, Edward    Farhi, Brooks Foxen, Austin Fowler, Craig Gidney, Marissa Giustina,    Rob Graff, Keith Guerin, Steve Habegger, Matthew P. Harrigan,    Michael J. Hartmann, Alan Ho, Markus Hoffmann, Trent Huang,    Travis S. Humble, Sergei V. Isakov, Evan Jeffrey, Zhang Jiang, Dvir    Kafri, Kostyantyn Kechedzhi, Julian Kelly, Paul V. Klimov, Sergey    Knysh, Alexander Korotkov, Fedor Kostritsa, David Landhuis, Mike    Lindmark, Erik Lucero, Dmitry Lyakh, Salvatore Mandra, Jarrod R.    McClean, Matthew McEwen, Anthony Megrant, Xiao Mi, Kristel    Michielsen, Masoud Mohseni, Josh Mutus, Ofer Naaman, Matthew Neeley,    Charles Neill, Murphy Yuezhen Niu, Eric Ostby, Andre Petukhov,    John C. Platt, Chris Quintana, Eleanor G. Rieffel, Pedram Roushan,    Nicholas C. Rubin, Daniel Sank, Kevin J. Satzinger, Vadim    Smelyanskiy, Kevin J. Sung, Matthew D. Trevithick, Amit Vainsencher,    Benjamin Villalonga, Theodore White, Z. Jamie Yao, Ping Yeh, Adam    Zalcman, Hartmut Neven &John M. Martinis (2019): Quantum supremacy    using a programmable superconducting processor. Nature 574(7779),    pp. 505-510, doi:10.1038/541586-019-1666-5.-   [11] Niel de Beaudrap, Xiaoning Bian & Quanlong Wang (2019):    Techniques to reduce_/4-parity phase circuits, motivated by the ZX    calculus. arXiv.org.-   [12] Andrew M. Childs, Eddie Schoute & Cem M. Unsal (2019): Circuit    Transformations for Quantum Architectures. In Wim van Dam & Laura    Mancinska, editors: 14th Conference on the Theory of Quantum    Computation, Communication and Cryptography (TQC 2019), Leibniz    International Proceedings in Informatics (LIPIcs) 135, pp. 3:1-3:24,    doi:10.4230/LIPIcs.TQC.2019.3. Available at    http://drops.dagstuhl.de/opus/volltexte/2019/10395.-   [13] Andrew M. Childs, Yuan Su, Minh C. Tran, Nathan Wiebe & Shuchen    Zhu (2019): A Theory of Trotter Error. arXiv.org.-   [14] Bob Coecke & Ross Duncan (2011): Interacting Quantum    Observables: Categorical Algebra and Diagrammatics. New J. Phys    13(043016), doi:10.1088/1367-2630/13/4/043016. Available at    http://iopscience.iop.org/1367-2630/13/4/043016/.-   [15] Bob Coecke & Aleks Kissinger (2017): Picturing Quantum    Processes: A First Course in Quantum Theory and Diagrammatic    Reasoning. Cambridge University Press.-   [16] Alexander Cowtan, Silas Dilkes, Ross Duncan, Alexandre    Krajenbrink, Will Simmons & Seyon Sivarajah (2019): On the qubit    routing problem. In Wim van Dam & Laura Mancinska, editors: 14th    Conference on the Theory of Quantum Computation, Communication and    Cryptography (TQC 2019), Leibniz International Proceedings in    Informatics (LIPIcs) 135, pp. 5:1-5:32,    doi:10.4230/LIPIcs.TQC.2019.5. Available at    http://drops.dagstuhl.de/opus/volltexte/2019/10397.-   [17] Alexander Cowtan, Silas Dilkes, Ross Duncan, Will Simmons &    Seyon Sivarajah (2019): Phase Gadget Synthesis for Shallow Circuits.    In: Proceedings of QPL2019 (to appear).-   [18] Ophelia Crawford, Barnaby van Straaten, Daochen Wang, Thomas    Parks, Earl Campbell & Stephen Brierley (2019): Efficient quantum    measurement of Pauli operators. arXiv.org.-   [19] Andrew Fagan & Ross Duncan (2019): Optimising Clifford Circuits    with Quantomatic. In Peter Selinger & Giulio Chiribella, editors:    Proceedings of the 15th International Conference on Quantum Physics    and Logic, Halifax, Canada, 3-7th June 2018, Electronic Proceedings    in Theoretical Computer Science 287, Open Publishing Association,    pp. 85-105, doi:10.4204/EPTCS.287.5.-   [20] Kaiwen Gui, Teague Tomesh, Pranav Gokhale, Yunong Shi,    Frederic T. Chong, Margaret Martonosi & Martin Suchara (2020): Term    Grouping and Travelling Salesperson for Digital Quantum Simulation.    arXiv.org.-   [21] Matthew B. Hastings, Dave Wecker, Bela Bauer & Matthias Troyer    (2014): Improving Quantum Algorithms for Quantum Chemistry. Quantum    Information and Computation 15.-   [22] Andrew Jena, Scott Genin & Michele Mosca (2019): Pauli    Partitioning with Respect to Gate Sets. arXiv.org.-   [23] Aleks Kissinger & Arianne Meijer van de Griend (2020): CNOT    circuit extraction for topologically constrained quantum memories.    Quantum Information and Computation. To appear.-   [24] Aleks Kissinger & John van de Wetering (2019): Reducing T-count    with the ZX-calculus. arXiv.org.-   [25] Vadym Kliuchnikov & Dmitri Maslov (2013): Optimization of    Clifford circuits. Phys. Rev. A 88, p. 052307,    doi:10.1103/PhysRevA.88.052307. Available at    https://link.aps.org/doi/10.1103/PhysRevA.88.052307.-   [26] Lingling Lao, Daniel M. Manzano, Hans van Someren, Imran Ashraf    & Carmen G. Almudever (2019): Mapping of quantum circuits onto NISQ    superconducting processors. arXiv.org.-   [27] Joonho Lee, William J. Huggins, Martin Head-Gordon & K.    Birgitta Whaley (2019): Generalized Unitary Coupled Cluster Wave    functions for Quantum Computation. Journal of Chemical Theory and    Computation 15(1), pp. 311-324, doi:10.1021/acs.jctc.8b01004.    Available at https://doi.org/10.1021/acs.jctc.8b01004.-   [28] Daniel Litinski (2019): Magic State Distillation: Not as Costly    as You Think. Quantum 3, p. 205, doi:10.22331/q-2019-12-02-205.    Available at http://dx.doi.org/10.22331/q-2019-12-02-205.-   [29] Seth Lloyd (1996): Universal Quantum Simulators. Science    273(5278), pp. 1073-1078, doi:10.1126/science.273.5278.1073.-   [30] Dmitri Maslov & Martin Roetteler (2017): Shorter stabilizer    circuits via Bruhat decomposition and quantum circuit    transformations. IEEE Transactions on Information Theory (7), pp.    4729-4738, doi:10.1109/TIT.2018.2825602.-   [31] Jarrod R McClean, Jonathan Romero, Ryan Babbush & Alan    Aspuru-Guzik (2016): The theory of variational hybrid    quantum-classical algorithms. New Journal of Physics 18(2), p.    023023, doi:10.1088/1367-2630/18/2/023023. Available at    http://stacks.iop.org/1367-2630/18/i=2/a=023023.-   [32] Yunseong Nam, Neil J. Ross, Yuan Su, Andrew M. Childs & Dmitri    Maslov (2018): Automated optimization of large quantum circuits with    continuous parameters. npj Quantum Information 4(1), p. 23,    doi:10.1038/s41534-018-0072-4. Available at    https://doi.org/10.1038/s41534-018-0072-4.-   [33] Beatrice Nash, Vlad Gheorghiu & Michele Mosca (2019): Quantum    circuit optimizations for NISQ architectures. arXiv.org.-   [34] John Preskill (2018): Quantum Computing in the NISQ era and    beyond. Quantum 2, p. 79, doi:10.22331/q-2018-08-06-79. Available at    https://doi.org/10.22331/q-2018-08-06-79.-   [35] Jonathan Romero, Ryan Babbush, Jarrod R McClean, Cornelius    Hempel, Peter J Love & Alan Aspuru-Guzik (2018): Strategies for    quantum computing molecular energies using the unitary coupled    cluster ansatz. Quantum Science and Technology 4(1), p. 014008,    doi:10.1088/2058-9565/aad3e4. Available at    https://iopscience.iop.org/article/10.1088/2058-9565/aad3e4.-   [36] Mark Steudtner & Stephanie Wehner (2018): Fermion-to-qubit    mappings with varying resource requirements for quantum simulation.    New Journal of Physics 20(6), p. 063010,    doi:10.1088/1367-2630/aac54f. Available at    https://iopscience.iop.org/article/10.1088/1367-263.-   [37] Dave Wecker, Matthew B. Hastings & Matthias Troyer (2015):    Progress towards practical quantum variational algorithms. Phys.    Rev. A 92, p. 042303, doi:10.1103/PhysRevA.92.042303. Available at    https://link.aps.org/doi/10.1103/PhysRevA.92.042303.-   [38] K. Wright, K. M. Beck, S. Debnath, J. M. Amini, Y. Nam, N.    Grzesiak, J. S. Chen, N. C. Pisenti, M. Chmielewski, C.    Collins, K. M. Hudek, J. Mizrahi, J. D. Wong-Campos, S. Allen, J.    Apisdorf, P. Solomon, M. Williams, A. M. Ducore, A. Blinov, S. M.    Kreikemeier, V. Chaplin, M. Keesan, C. Monroe &J. Kim (2019):    Benchmarking an 11-qubit quantum computer. Nature Communications    10(1), p. 5464, doi:10.1038/s41467-019-13534-2.-   [39] Bujiao Wu, Xiaoyu He, Shuai Yang, Lifu Shou, Guojing Tian,    Jialin Zhang & Xiaoming Sun (2019): Optimization of CNOT circuits on    topological superconducting processors. arXiv.org.-   [40] Andrew Zhao, Andrew Tranter, William M. Kirby, Shu Fay Ung,    Akimasa Miyake & Peter Love (2019): Measurement reduction in    variational quantum algorithms. arXiv.org.-   [41] Alwin Zulehner, Alexandru Paler & Robert Wille (2017): An    Efficient Methodology for Mapping Quantum Circuits to the IBM QX    Architectures. arXiv.org.0/aac54f.-   https://quantaggle.com/algorithms/algorithm/#VQE-   https://quantaggle.com/algorithms/ansatz/#UCC-   https://cqcl.githubio/pytket/build/html/index.html-   https://en.wikipedia.org/wiki/Clifford_gates-   https://en.wikipedia.org/wiki/Basis_set_%28chemistry %29-   https://arxiv.org/pdf/1906.01734.pdf-   https://en.wikipedia.org/wiki/Pauli_matrices-   https://qiskit.org/-   https://arxiv.org/abs/1709.03489-   https://www.martincarlisle.com/publications/kcoloring.pdf-   https://arxiv.org/abs/1910.04735-   https://arxiv.org/abs/cond-mat/9510145-   https://www.cond-mat.de/events/correl16/manuscripts/scalettar.pdf

http://aliramadhan.me/files/jaynes-cummings-model.pdf

https://arxiv.org/abs/nucl-th/0308088

https://networkx.github.io/documentation/stable/reference/algorithms/coloring.html

https://arxiv.org/abs/1704.05018

The invention claimed is:
 1. A computer-implemented method of generatinga quantum circuit from a Unitary Coupled Cluster (UCC) ansatz whichrepresents an excitation of a reference state by a parameterisedoperator including excitation operators, the UCC ansatz includingmulti-qubit Pauli operators, referred to as Pauli strings, determinedfrom each excitation operator, the method comprising: partitioning thePauli strings into mutually commuting sets and sequencing the Paulistrings by set; generating Pauli gadgets from the Pauli strings byTrotterization, wherein the Pauli gadgets have the same sequencing byset as the Pauli strings; diagonalising each set of Pauli gadgets toconvert the Pauli gadgets into phase gadgets; transforming the phasegadgets into one- and two-qubit native gates to generate the quantumcircuit.
 2. The method of claim 1, wherein partitioning the Paulistrings into mutually commuting sets seeks to minimise the number ofsets.
 3. The method of claim 1, wherein the partitioning the Paulistrings comprises partitioning the Pauli strings using a graph colouringalgorithm.
 4. The method of claim 1, wherein a phase gadget is a Pauligadget comprising only Z and I letters.
 5. The method of claim 1,wherein each set of Pauli gadgets is diagonalised using a Cliffordcircuit.
 6. The method of claim 5, wherein each set of Pauli gadgets isrepresented as: (i) a Clifford circuit; (ii) a set of phase gadgets, and(iii) an inverse Clifford circuit.
 7. The method of claim 6, wherein theClifford circuits transform between an original basis of the Pauligadgets and a new basis in which the Pauli gadgets are represented by acorresponding set of phase gadgets.
 8. The method of a claim 1, in whichfor two qubits i and j, and S being a set of m mutually commuting Pauligadgets and σ_(kl) a Pauli letter on qubit k from Pauli gadget I, qubiti or j is diagonalised by conjugating with at most one entangling gateand two single-qubit Clifford gates on each side of S between qubits iand j, providing:∃A,B∈{X,Y,Z}s.t.∀l∈{1, . . . ,m},σ _(il) {I,A}⇔σ _(jl) ∈{I,B}
 9. Themethod of claim 8, wherein if the proviso of claim 8 is not satisfied,the diagonalisation is performed by: finding a Pauli string with thelowest weight; conjugating the Pauli gadget corresponding to the Paulistring with the lowest weight with a single-qubit Clifford gate andentangling gates; and commuting the Clifford gates through the rest ofthe Pauli gadgets until all the Clifford gates are outside the adjacentPauli gadgets.
 10. The method of claim 1, wherein transforming the phasegadgets into one- and two-qubit native gates to generate the quantumcircuit includes using phase polynomial formalism.
 11. The method ofclaim 10, wherein transforming the phase gadgets by using the phasepolynomial formalism includes using a GraySynth procedure.
 12. Themethod of claim 1, further comprising: performing Clifford peepholeoptimisation by finding patterns of two-qubit Clifford circuits; andreplacing the found patterns of two-qubit Clifford circuits withequivalent circuits having lower counts of entangling gates.
 13. Themethod of claim 1, wherein the method reduces the count and depth ofentangling gates of the quantum circuit relative to a naïve synthesis ofthe quantum circuit from the Pauli strings.
 14. The method of claim 1,wherein the UCC corresponds to a molecular structure.
 15. The method ofclaim 1, wherein the UCC corresponds to a quantum system which has aHamiltonian which is subject to Trotterization.
 16. A system comprisingat least one processor and a compiler configured to run on the processorto generate a quantum circuit from a Unitary Coupled Cluster (UCC)ansatz which represents an excitation of a reference state by aparameterised operator including excitation operators, the UCC ansatzincluding multi-qubit Pauli operators, referred to as Pauli strings,determined from each excitation operator, the compiler being configuredto: partition the Pauli strings into mutually commuting sets andsequencing the Pauli strings by set; generate Pauli gadgets from thePauli strings by Trotterization, wherein the Pauli gadgets have the samesequencing by set as the Pauli strings; diagonalise each set of Pauligadgets to convert the Pauli gadgets into phase gadgets; and transformthe phase gadgets into one- and two-qubit native gates to generate thequantum circuit.
 17. A computer-implemented method of generating aquantum circuit from a Hamiltonian using a parameterised operatorincluding excitation operators to represent an excitation of a referencestate, wherein multi-qubit Pauli operators, referred to as Paulistrings, are determined from each excitation operator, the methodcomprising: partitioning the Pauli strings into mutually commuting setsand sequencing the Pauli strings by set; generating Pauli gadgets fromthe Pauli strings by Trotterization, wherein the Pauli gadgets have thesame sequencing by set as the Pauli strings; diagonalising each set ofPauli gadgets to convert the Pauli gadgets into phase gadgets; andtransforming the phase gadgets into one- and two-qubit native gates togenerate the quantum circuit.
 18. The method of claim 17, wherein theHamiltonian corresponds to a Quantum Approximate Optimization Algorithm.19. A system comprising at least one processor and a compiler configuredto run on the processor to generate a quantum circuit from a Hamiltonianusing a parameterised operator including excitation operators torepresent an excitation of a reference state, wherein multi-qubit Paulioperators, referred to as Pauli strings, are determined from eachexcitation operator, the compiler being configured to: partition thePauli strings into mutually commuting sets and sequencing the Paulistrings by set; generate Pauli gadgets from the Pauli strings byTrotterization, wherein the Pauli gadgets have the same sequencing byset as the Pauli strings; diagonalise each set of Pauli gadgets toconvert the Pauli gadgets into phase gadgets; and transform the phasegadgets into one- and two-qubit native gates to generate the quantumcircuit.